In advanced technology nodes of semiconductor industry, metal and high k dielectric material are used to form a metal gate stack of a field-effect transistor (FET). When forming a metal gate FET, one or more ion implanting processes are used to form doped features of the FET. A patterned photoresist layer is used as a mask in the ion implanting process. The patterned photoresist layer is removed thereafter. However, when a dry stripping process is used to remove the patterned photoresist layer, the substrate is recessed. When a wet stripping is used to remove the patterned photoresist layer, the photoresist residue cannot be completely removed.